Skip to content

Conversation

saqadri
Copy link
Collaborator

@saqadri saqadri commented Sep 15, 2025

add a hello world example

Summary by CodeRabbit

  • New Features
    • Added quickstart commands to copy example servers: reference, elicitation, sampling, notifications.
    • init gains --list/-l to list templates and auto-generates a README with filename fallbacks.
    • Basic template simplified with example tools and clearer local/deploy workflow.
    • Config template refined: console+file logging, filesystem root included, sample agents, updated model defaults.
  • Documentation
    • New READMEs for reference, elicitation, sampling, notifications examples and starter template.
  • Refactor
    • Enhanced type-safety for tool decorators; no runtime changes.
  • Style
    • Minor formatting and logging line wraps; no behavioral impact.

Copy link

coderabbitai bot commented Sep 15, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Adds generic typing and overloads to MCPApp tool decorators and LLM factory. Expands CLI with README generation and new quickstart commands. Introduces four example MCP agent servers (reference, elicitation, sampling, notifications) with clients and READMEs. Updates basic template and config. Minor formatting in an example file.

Changes

Cohort / File(s) Summary
Decorator typing updates
src/mcp_agent/app.py
Adds ParamSpec/TypeVar, overloads, and generic-preserving signatures for tool and async_tool; runtime behavior maintained.
CLI init enhancements
src/mcp_agent/cli/commands/init.py
Adds _write_readme with fallback filenames; integrates README creation across templates; introduces --list/-l to list templates; tweaks defaults and output messaging.
CLI quickstart additions
src/mcp_agent/cli/commands/quickstart.py
Adds commands to copy example servers: reference-agent-server, elicitation, sampling, notifications; packaging-first copy with repo fallback.
LLM factory overloads
src/mcp_agent/workflows/factory.py
Introduces overloads for create_llm supporting Agent/AgentSpec or agent_name+routing styles; normalizes inputs to build AugmentedLLM.
Template refresh
src/mcp_agent/data/templates/basic_agent.py
Rewrites basic template to a concise MCPApp with @app.tool and @app.async_tool; new main; removes prior token/demo scaffolding.
Template README and config
src/mcp_agent/data/templates/README_init.md, src/mcp_agent/data/templates/mcp_agent.config.yaml
Adds starter README; reorganizes config: logger transports, filesystem args include ".", adds agents block, updates model defaults, comments for OTEL/env.
Reference server example
src/mcp_agent/data/examples/mcp_agent_server/reference/server.py, .../reference/client.py, .../reference/README.md
Adds a typed reference agent server with tools (finder, notify, confirm_action, sample_haiku); client exercising tools; README with run/deploy notes.
Elicitation server example
src/mcp_agent/data/examples/mcp_agent_server/elicitation/server.py, .../elicitation/client.py, .../elicitation/README.md
Adds elicitation demo with confirm_action using upstream or local elicitation; client to call tool; README with run/deploy steps.
Sampling server example
src/mcp_agent/data/examples/mcp_agent_server/sampling/server.py, .../sampling/client.py, .../sampling/README.md
Adds LLM sampling demo with sample_haiku; client to invoke; README with setup/deploy.
Notifications server example
src/mcp_agent/data/examples/mcp_agent_server/notifications/server.py, .../notifications/client.py, .../notifications/README.md
Adds notifications demo with notify and notify_progress; client to send messages; README with run/deploy.
Minor formatting
examples/mcp/mcp_elicitation/cloud/main.py
Formatting-only edits; no behavior changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Client as MCP Client App
  participant SSE as SSE Transport
  participant Server as Elicitation Server (MCPApp)
  participant Upstream as Upstream Client (Elicitation)

  Note over Client,Server: Elicitation flow: confirm_action
  User->>Client: Initiate confirm_action("proceed")
  Client->>SSE: send tool.call(confirm_action)
  SSE->>Server: deliver request
  Server->>Server: Build schema (ConfirmBooking)
  alt Upstream elicitation available
    Server->>Upstream: elicit(schema, prompt)
    Upstream-->>Server: {"confirm": true|false, "notes": "..."}
  else Local handler available
    Server->>Server: app.context.elicitation_handler(...)
    Server-->>Server: result
  else No elicitation channels
    Server->>Server: default decision
  end
  Server-->>SSE: return result string
  SSE-->>Client: tool.result
  Client-->>User: Display result
Loading
sequenceDiagram
  autonumber
  participant Client as Notifications Client
  participant SSE as SSE Transport
  participant Server as Notifications Server (MCPApp)
  participant Upstream as Upstream Session

  Note over Client,Server: Notifications tools (best-effort)
  Client->>SSE: call notify("hello", "info")
  SSE->>Server: invoke notify
  Server->>Server: app.logger.info("hello")
  Server-->>SSE: "ok"
  Client->>SSE: call notify_progress(0.5, "Halfway")
  SSE->>Server: invoke notify_progress
  alt Upstream available
    Server->>Upstream: send_progress_notification(token, 0.5, "Halfway")
    Upstream-->>Server: ack
    Server-->>SSE: "ok"
  else Missing upstream
    Server->>Server: log warning
    Server-->>SSE: "no-upstream"
  end
Loading
sequenceDiagram
  autonumber
  participant Client as Sampling Client
  participant SSE as SSE Transport
  participant Server as Sampling Server (MCPApp)
  participant LLM as Augmented LLM

  Note over Client,Server: sample_haiku(topic)
  Client->>SSE: call sample_haiku("mountains")
  SSE->>Server: invoke tool
  Server->>LLM: generate_str("Haiku about mountains", params)
  LLM-->>Server: "three-line haiku..."
  Server-->>SSE: return string
  SSE-->>Client: tool.result
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • StreetLamb

Poem

A rabbit taps keys with a gentle sway,
New servers hop in for a demo day.
Tools now typed, decorators spry,
Quickstarts sprout and configs fly.
From haiku peaks to pings that gleam—
Elicit, notify, sample the dream.
Hippity dev, ship the stream! 🐇✨

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/init_templates

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f10f6ea and a4287a2.

📒 Files selected for processing (20)
  • examples/mcp/mcp_elicitation/cloud/main.py (2 hunks)
  • src/mcp_agent/app.py (6 hunks)
  • src/mcp_agent/cli/commands/init.py (7 hunks)
  • src/mcp_agent/cli/commands/quickstart.py (2 hunks)
  • src/mcp_agent/data/examples/mcp_agent_server/elicitation/README.md (1 hunks)
  • src/mcp_agent/data/examples/mcp_agent_server/elicitation/client.py (1 hunks)
  • src/mcp_agent/data/examples/mcp_agent_server/elicitation/server.py (1 hunks)
  • src/mcp_agent/data/examples/mcp_agent_server/notifications/README.md (1 hunks)
  • src/mcp_agent/data/examples/mcp_agent_server/notifications/client.py (1 hunks)
  • src/mcp_agent/data/examples/mcp_agent_server/notifications/server.py (1 hunks)
  • src/mcp_agent/data/examples/mcp_agent_server/reference/README.md (1 hunks)
  • src/mcp_agent/data/examples/mcp_agent_server/reference/client.py (1 hunks)
  • src/mcp_agent/data/examples/mcp_agent_server/reference/server.py (1 hunks)
  • src/mcp_agent/data/examples/mcp_agent_server/sampling/README.md (1 hunks)
  • src/mcp_agent/data/examples/mcp_agent_server/sampling/client.py (1 hunks)
  • src/mcp_agent/data/examples/mcp_agent_server/sampling/server.py (1 hunks)
  • src/mcp_agent/data/templates/README_init.md (1 hunks)
  • src/mcp_agent/data/templates/basic_agent.py (1 hunks)
  • src/mcp_agent/data/templates/mcp_agent.config.yaml (1 hunks)
  • src/mcp_agent/workflows/factory.py (3 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@saqadri saqadri marked this pull request as ready for review September 17, 2025 21:55
@saqadri saqadri merged commit 3c871f7 into main Sep 17, 2025
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant